package org.dromara.exam.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.exam.domain.vo.CountByMonthVo;
import org.dromara.exam.domain.vo.CountScoreVo;
import org.dromara.exam.service.IDataDisplayService;
import org.dromara.system.domain.bo.SysDeptBo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据展示
 * @author :xiyin321
 * @since : 2024/6/9 22:57
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/exam/data")
public class DataDisplayController {
    private final IDataDisplayService dataDisplayService;

    /*获取用户数量*/
    @GetMapping("/userCount")
    public R<Long> getUserCount(){
        return R.ok(dataDisplayService.queryUserCount());
    }

    /*获取题目数量*/
    @GetMapping("/questionCount")
    public R<Long> getQuestionCount(){
        return R.ok(dataDisplayService.queryQuestionCount());
    }
    /*获取部门数量*/
    @GetMapping("/deptCount")
    public R<Long> getDeptCount(SysDeptBo bo){
        return R.ok(dataDisplayService.queryDeptCount(bo));
    }
    /*
    * 查询题目数量
    * @return list<> year-month,count
    * */
    @GetMapping("/questionCountByMonth")
    public R<List<CountByMonthVo>> getQuestionCountByMonth(){
        return R.ok(dataDisplayService.queryQuestionCountByMonth());
    }
    /*查询答卷数量*/
    @GetMapping("/answerCountByMonth")
    public R<List<CountByMonthVo>> getAnswerCountByMonth(){
        return R.ok(dataDisplayService.queryAnswerCountByMonth());
    }

    /*获取当前用户的成绩统计*/
    @GetMapping("/userScore")
    public R<List<CountScoreVo>> getUserScore(){
        return R.ok(dataDisplayService.queryUserScore());
    }
}
